var util = require("../../../utils/util.js"),
api = require("../../../utils/api.js"),
 app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    detail:{},
    configInfo:{},
    configDetail:{},
    showShare:false,
    options: [
      { name: '微信分享', icon: 'wechat', openType: 'share' },
    //   { name: '复制pdf链接', icon: 'link' },
    //   { name: '下载pdf', icon: 'poster' } 
    ],
    active:0,
    id:0,
    ordernum:0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    if(options.id){
      this.detail(options)
      this.setData({id:options.id})
    }
    if(options.ordernum){        
        this.setData({ordernum:options.ordernum})
      }
  },
  claimant(){
    const {ordernum,id,serverid}=this.data.detail;
    wx.navigateTo({
      url: `/pages/mine/myorder/process?ordernum=${ordernum}&serverid=${serverid}&uclatid=${id}`
    })
  },
  detail(option){ 
    api.default._serverInclaimantDetail({ordernum:option.ordernum}).then(res => {
      this.setData({detail:res.data})
    })
  },
  telphone(e){
    let phone = e.currentTarget.dataset.phone;
    wx.makePhoneCall({
      phoneNumber: phone
    })
  },
  getConfig(){
    api.default.config().then((a) => {
      this.setData({
        configInfo: a.data
      })
    });
  },

  onChange(e) {
    this.setData({
      active:e.detail.index
    })
  },
  onClose(){
    this.setData({
      showShare: false
    })
  },
  gotoNext(){
      console.log(22);
    this.setData({
      showShare: true
    })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
    const {id,ordernum}=this.data;
    let path=`/pages/mine/myorder/orderdetail?id=${id}&ordernum=${ordernum}`;
    return util.shareEvent({
      path,title: '订单详情'
    })
  }
})